﻿@using ZBJF.Warranty.Common.Enums
@using ZBJF.Warranty.Model
@{
    Layout = null;
    List<PageMenu> pageMuneList = PageData["PageMuneList"] as List<PageMenu>;

    int pid = (int)PageData["Pid"];
    var menuList = pageMuneList.Where(m => m.ParentID == pid && m.BelongApplicationType == (byte)ApplicationType.CustomerServiceSite).OrderBy(c => c.OrderIndex); ;
    var i = 0;
}
@foreach (var item in menuList)
{
    var hasChildMenu = pageMuneList.Any(m => m.ParentID == item.ID);
    var hasParent = pageMuneList.Any(m => m.ID == item.ParentID);
    if (hasChildMenu)//有子菜单，只分两级（只兼容两级菜单）
    {
        <div class="accordion-group">
            <div class="accordion-heading">
                <a class="accordion-toggle" data-toggle="collapse" data-parent="#menu" href="#collapse_@item.ID" title="">
                    @if (true)
                    {
                        <text> <i class="@item.IcoClass"></i> </text>
                    }@(item.PageName)
                </a>
            </div>
            <div id="collapse_@item.ID" class="accordion-body collapse @(i==0?"in":"")">
                <div class="accordion-inner">
                    <ul class="nav nav-list">
                        @RenderPage("/Views/Shared/LeftMenuTemplate/LeftMenuPartail.cshtml", new { PageMuneList = pageMuneList, Pid = item.ID })
                    </ul>
                </div>
            </div>
        </div>
                    i++;
    }
    else if (hasParent)//判断有没有父菜单以确认是否是子菜单
    {
        <li>
            <a href="@item.PageUrl" target="mainFrame"><i class="@item.IcoClass"></i>@(item.PageName)</a>
        </li>
    }
}
